import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/index.vue'
import ProduceRoutes from './modules/produce'

export const routes: RouteRecordRaw[] = [// 路由规则
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '', // 默认子路由
        name: 'Dashboard',
        component: () => import('@/views/dashboard/index.vue'),
        meta: {
          title: 'Dashboard',
          icon: 'dashboard'
        }
      }
    ]
  },
  {
    path: '/home',
    component: Layout,
    children: [
      {
        path: '', // 默认子路由
        name: 'Home',
        component: () => import('@/views/home/index.vue'),
        meta: {
          title: 'Home',
          icon: 'setting'
        }
      }
    ]
  },
  ProduceRoutes
]

const router = createRouter({
  routes,
  history: createWebHashHistory() // 路由模式
})

export default router
